package practice07;


public class Teacher extends Person {
    private String name;
    private int age;
    private Klass klass;

    public Teacher(String name, int age, Klass klass) {
        super(name, age);
        this.name = name;
        this.age = age;
        this.klass = klass;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int getAge() {
        return age;
    }

    @Override
    public void setAge(int age) {
        this.age = age;
    }

    public Teacher(String name, int age) {
        super(name, age);
    }

    public String introduceWith(Student stu) {
        if (stu.klass.getNumber() == this.klass.getNumber()) {
            return "My name is " + this.name + ". I am " + this.age + " years old. I am a Teacher. I teach " + stu.getName() + ".";
        } else {
            return "My name is " + this.name + ". I am " + this.age + " years old. I am a Teacher. I don't teach " + stu.getName() + ".";
        }

    }

    public String introduce() {

        if (this.klass != null) {
            return super.introduce() + " I am a Teacher. I teach Class " + klass.getNumber() + ".";
        } else {
            return super.introduce() + " I am a Teacher. I teach No Class.";
        }


    }

    public Klass getKlass() {
        return klass;
    }
}
